<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加用户</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="js/crlCheckCommons.js"></script>
<script type="text/javascript" src="js/calendar/WdatePicker.js"></script>
<link rel="stylesheet" href="css/jquery.autocomplete.css" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/font-awesome.min.css" rel="stylesheet" />
<link href="css/animate.css" rel="stylesheet" />
<link href="css/plugins/summernote/summernote.css" rel="stylesheet" />
<link href="css/plugins/summernote/summernote-bs3.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<style>
.bor {
	border: 0px solid #ccc;
}

#emptable td {
	border: none !important;
}

td {
	margin: 0;
	padding-left: 16px;
	border: none;
	text-align: left;
}

.td {
	font-size: 16px;
	border: none;
	text-align: right;
}

#button {
	border-radius: 10px;
	margin-left: 10px;
	width: 135px;
	height: 30px;
	border: none;
	font-size: 16px;
	color: #fff;
	background-color: #47a4e1;
}

.form-body .col-md-6, .form-body .col-md-12 {
	min-height: 400px;
}

#apro, #bpro, #cpro {
	display: none;
}

#baBodysubmit {
	padding-left: 90px;
	margin-top: 0;
}
</style>
</head>
<body style="background: white">
	
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="img/coin02.png" /> <span><a href="main.do">首页</a>&nbsp;-&nbsp;<a
					href="userinfo.do">用户管理</a>&nbsp;-&nbsp;编辑用户&nbsp;&nbsp;</span>
			</div>
		</div>
		<div class="page ">
			<!-- 上传广告页面样式 -->
			<div class="banneradd bor">
				<form:form action="userupdate.do" method="post" id="form"
					modelAttribute="user" onsubmit="return checkform()">
					<div class="baTopNo">
						<span></span>
					</div>
					<div class="baBody">
						<div class="row form-body form-horizontal m-t">

							<div class="col-sm-6">
								<div class="ibox float-e-margins">

									<div class="col-md-12">
										<div class="form-group">
											<label class="col-sm-3 control-label">用户名：<span
												style="color: red">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="username" class="form-control"
													id="username"  value="${user.username }" readonly="readonly" />
													<input type="hidden" name="id" class="form-control" value="${user.id }" />
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">密码：<span
												style="color: red">*</span></label>
											<div class="col-sm-9">
												<input type="password" name="password" class="form-control" id="password" value="${user.password }" readonly="readonly" />			
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label" for="-NaN">身份：<span
												style="color: red">*</span></label>
											<div class="col-sm-9">
												<select class="form-control" name="role.id">
													<option value="1" <c:if test="${user.role.id ==1 }">selected="selected"</c:if>>超级管理员</option>
													<option value="2" <c:if test="${user.role.id ==2 }">selected="selected"</c:if>>管理员</option>
													<option value="3" <c:if test="${user.role.id ==3 }">selected="selected"</c:if>>普通员工</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">员工姓名：<span
												style="color: red">*</span></label>
											<div class="col-sm-9">
												<input type="text"  class="form-control"
													id="empname" value="${user.empname }" readonly="readonly"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">员工电话：<span
												style="color: red">*</span></label>
											<div class="col-sm-9">
												<input type="text"  class="form-control"
													id="phone" value="${user.phone }" readonly="readonly" />
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="baBody" id="baBodysubmit">
						<table>
							<tr class="bbD">
								<td class="td"></td>
								<td><input type="submit" value="确认" id="button" /> <input
									type="reset" value="重置" id="button" /></td>
							</tr>
						</table>
					</div>
				</form:form>
			</div>
			<!-- 上传广告页面样式end -->
		</div>
	</div>
	<script>
			//JS验证
			$("#username").blur(
					function() {
						if (required($(this), '用户名不能为空')
								&& minLength($(this), 4, '姓名最小长度为4')
								&& maxLength($(this), 20, '姓名最大长度为20'))
							;
					});
			$("#password").blur(
					function() {
						if (required($(this), '密码不能为空')
								&& minLength($(this), 4, '密码最小长度为4')
								&& maxLength($(this), 20, '密码最大长度为20'))
							;
					});
			$("#empname").blur(
					function() {
						if (required($(this), '姓名不能为空')
								&& minLength($(this), 2, '机构最小长度为2'))
							;
					});
			
		function checkform() {
			haveError = false; //全局错误信息变量, 如果有错误,变量值会变成ture  ,再验证完所有之后再判断,是否要提交表单
			$("#username").blur();
			$("#password").blur();
			$("#empname").blur();
			if (!haveError) {
				return true;
			} else {
				alert("请填写完整");
				return false;
			}
		}
	</script>
</body>
</html>